package com.wocai.jrt.orgadmin.product.service.impl;

import java.util.List;

import javax.inject.Inject;
import javax.inject.Named;

import com.vteba.service.generic.impl.MyBatisServiceImpl;
import com.vteba.tx.jdbc.mybatis.spi.BaseDao;
import com.wocai.jrt.orgadmin.product.bean.CommissionSetResBean;
import com.wocai.jrt.orgadmin.product.bean.ProductReqBean;
import com.wocai.jrt.orgadmin.product.dao.ProductDao;
import com.wocai.jrt.orgadmin.product.model.Product;
import com.wocai.jrt.orgadmin.product.model.ProductBean;
import com.wocai.jrt.orgadmin.product.model.ProductFundsUse;
import com.wocai.jrt.orgadmin.product.service.spi.ProductService;
import com.wocai.jrt.orgadmin.stats.bean.IndexStatsReqBean;
import com.wocai.jrt.orgadmin.stats.bean.Pie;

/**
 * 产品相关的service业务实现。
 * @author yinlei
 * @date 2015-8-13 16:43:26
 */
@Named
public class ProductServiceImpl extends MyBatisServiceImpl<Product, ProductBean, String> implements ProductService {
	// 添加了方法后，记得改为private
	protected ProductDao productDao;
	
	@Override
	@Inject
	public void setBaseDao(BaseDao<Product, ProductBean, String> productDao) {
		this.baseDao = productDao;
		this.productDao = (ProductDao) productDao;
	}

	@Override
	public List<CommissionSetResBean> getCommissionSet(Product product) {
		return productDao.getCommissionSet(product);
	}

	@Override
	public List<Product> relatedPagedList(Product product) {
		return productDao.relatedPagedList(product);
	}
	
	/**
	 * 获取机构下可买产品
	 * @param product
	 * @return List<Product>
	 * @author zhangyz
	 */
	@Override
	public List<Product> getBuyableProducts(Product product) {
		return productDao.getBuyableProducts(product);
	}

	@Override
	public List<CommissionSetResBean> getSaleAllCommissionSet(Product product) {
		return productDao.getSaleAllCommissionSet(product);
	}

	@Override
	public List<Pie> productSale(IndexStatsReqBean indexStatsReqBean) {
		return productDao.productSale(indexStatsReqBean);
	}

	@Override
	public Product getDetail(ProductReqBean productReqBean) {
		return productDao.getDetail(productReqBean);
	}

	@Override
	public int nativeCountBy(Product product) {
		return productDao.nativeCountBy(product);
	}

	@Override
	public List<Product> issuersPagedList(Product model) {
		List<Product> productLists = productDao.issuersPagedList(model);
		return productLists;
	}

	@Override
	public int issuersCountBy(Product model) {
		return productDao.issuersCountBy(model);
	}

	@Override
	public int updateAddOrEditById(Object obj) {
		return productDao.updateAddOrEditById(obj);
	}

	@Override
	public List<ProductFundsUse> getFundsUse(Product product) {
		return productDao.getFundsUse(product);
	}

	@Override
	public int countByState(Product model) {
		return productDao.countByState(model);
	}

}
